﻿
<CnGalWebSite.Components.Containers.MasaTitleContainer Outline Title="编辑记录" Icon="@IconType.EditRecord.ToIconString()">
     <div class="overflow-y-auto overflow-x-hidden" style="max-height: 600px;padding: 3px;">
         <div class="row">
            @foreach (var item in Model.Examines.OrderByDescending(s => s.Id))
            {
                <div class="col-12 col-md-6 col-lg-12 mb-3">
                    <MDCard ShowHoverStyle="true" OnClick="@(()=>OnSeletedItemChanged(item))" Color="@(item.IsSelected?"primary":"background")" Class="elevation-2">
                        <EditRecordInforCard Model="item" />
                    </MDCard>
                </div>
            }
        </div>
    </div>
</CnGalWebSite.Components.Containers.MasaTitleContainer>

@code {
    [Parameter]
    public ExaminesOverviewViewModel Model { get; set; }
    [Parameter]
    public EventCallback<EditRecordAloneViewModel> OnClickEditRecord { get; set; }

    public string ImageMinWidth { get; set; }

    public async Task OnSeletedItemChanged(EditRecordAloneViewModel item)
    {
        item.IsSelected = !item.IsSelected;
        foreach (var temp in Model.Examines)
        {
            if (temp == item)
            {
                temp.IsSelected = true;
            }
            else
            {
                temp.IsSelected = false;
            }
        }
        StateHasChanged();
        await OnClickEditRecord.InvokeAsync(item);

    }
}
